package com.test.service.impl;

import com.test.mapper.DinnerTableMapper;
import com.test.pojo.DinnerTable;
import com.test.service.DinnerTableService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DinnerTableServiceImpl implements DinnerTableService {

    @Resource
    private DinnerTableMapper dinnerTableMapper;

    @Override
    public List<DinnerTable> getAllDinnerTable() {
        return dinnerTableMapper.getAllDinnerTable();
    }

    @Override
    public int updateDinnerTableStatus(DinnerTable dinnerTable) {
        return dinnerTableMapper.updateDinnerTableStatus(dinnerTable);
    }

    @Override
    public int deleteDinnerTable(int tableId) {
        int num;
        try{
            num = dinnerTableMapper.deleteDinnerTable(tableId);
        }catch (Exception e){
            num=-1;
        }
        return num;
    }

    @Override
    public int addDinnerTable(DinnerTable dinnerTable) {
        return dinnerTableMapper.addDinnerTable(dinnerTable);
    }

    @Override
    public List<DinnerTable> serachDinnerTable(String dinnerTable) {
        return dinnerTableMapper.serachDinnerTable(dinnerTable);
    }

    @Override
    public DinnerTable getDinnerTableByID(int tableId) {
        return dinnerTableMapper.getDinnerTableByID(tableId);
    }
}
